/*
 * @Description:
 * @Autor: 
 * @Date: 2022-06-22 10:13:41
 * @LastEditors: 万洲
 * @LastEditTime: 2022-11-21 15:41:22
 */
import useUserStore from "@/store/useUserStore";
import { IUserApiResponse } from "@/types/user/IUserApiResponse";
import { TRequest } from "./Modules/HttpRequest";
import { $http } from "./Modules";

/**
 * 登陆
 * @param params
 * @returns
 */
export const reqLogin = <T>(params?: T): TRequest<string> => {
    const userStore = useUserStore()
    userStore.setToken(undefined)
    return new Promise(async (resolve) => {
        const url = "/login";
        let result = await $http.post(url, params);
        resolve(result);
    });
};
/**
 * 获取用户信息
 * @param params
 * @returns
 */
export const reqGetUserInfo = <T>(params?: T): Promise<IUserApiResponse> => {
    return new Promise(async (resolve) => {
        const url = "/getInfo";
        let result = await $http.get(url, params);
        resolve(result);
    });
};



